import mockjs from 'mockjs';

export default {
  'POST /api/user/getUserlist': (req, res) => {
    const { size, username } = req.body;
    if (username != null && username != undefined && username != '') {
      res.send(
        mockjs.mock({
          code: 200,
          message: '请求成功',
          data: {
            total: 2,
            page: 1,
            'items|2': [
              {
                'userId|+1': 1,
                username: '@name',
                'sex|1': ['男', '女'],
                trueName: '@name',
                telephone: '@phone',
                email: '@email',
                address: '@county(true)',
                introduce: '@cparagraph',
                'roleName|1': ['超级管理员', '管理员', '普通用户'],
                registTime: '@date',
              },
            ],
          },
        }),
      );
    } else {
      res.send(
        mockjs.mock({
          code: 200,
          message: '请求成功',
          data: {
            total: 50,
            page: 5,
            'items|50': [
              {
                'userId|+1': 1,
                username: '@name',
                'sex|1': ['男', '女'],
                trueName: '@name',
                telephone: '@phone',
                email: '@email',
                address: '@county(true)',
                introduce: '@cparagraph',
                'roleName|1': ['超级管理员', '管理员', '普通用户'],
                registTime: '@date',
              },
            ],
          },
        }),
      );
    }
    return;
  },
  'POST /api/user/insert': (req, res) => {
    res.send({
      code: 200,
      message: '添加成功',
      data: null,
    });
    return;
  },
  'POST /api/user/update': (req, res) => {
    res.send({
      code: 200,
      message: '修改成功',
      data: null,
    });
    return;
  },
  'POST /api/user/delete': (req, res) => {
    res.send({
      code: 200,
      message: '删除成功',
      data: null,
    });
    return;
  },
};
